module.exports = {
  // 服务器配置
  host: process.env.HOST || '0.0.0.0',
  port: parseInt(process.env.PORT) || 3000,

  // JWT密钥
  jwtSecret: process.env.JWT_SECRET || 'your_jwt_secret_key_change_this_in_production',

  // CORS配置
  cors: {
    origin: process.env.CORS_ORIGIN || '*',
    credentials: true,
    methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
    allowedHeaders: ['Content-Type', 'Authorization']
  },

  // 限流配置
  rateLimit: {
    windowMs: parseInt(process.env.RATE_LIMIT_WINDOW_MS) || 15 * 60 * 1000, // 15分钟
    max: parseInt(process.env.RATE_LIMIT_MAX_REQUESTS) || 100, // 每个IP在窗口期内最多100个请求
    message: {
      error: '请求过于频繁，请稍后再试',
      retryAfter: '15分钟后重试'
    },
    standardHeaders: true,
    legacyHeaders: false
  }
};
